//Created by Koza
//The world holds a 2D array of nodes
#pragma once

//Needs access to the objects and other members of the object.h
#include <Windows.h>
#include <assert.h>
#include "Globals.h"
#include "Base Object.h"

class Space : public BaseObject
{
private:
	//To determine what to do when the space is landed on
	eSpaceType			m_eTypeSpace;
	//The space before this one
	Space*				m_clpPrevConnection;
	//The next space after this one
	Space*				m_clpNextConnection;
	//Used to know where to move to if this space is landed on
	// and is a geyser or minecart
	Space*				m_clpNextConnectionSpecial;
	//What mineral type is portrayed
	// Used to determine which texture to display
	eTileType		m_eMineral;
	
	bool LastSpace;
public:
	//Base Constructor/Deconstructor
	Space();
	~Space();

	const bool ifLastSpace(){return LastSpace;}

	const void Init(int const & WorldX,int const & WorldY,eSpaceType const & SpaceType,Space* ConnectedTo);

	//Nulls out all the values
	// Also called in the constructor
	const void Clear();

	const void CreateSpace(int const & x,int const & y,eTileType const & Mat,Space* ConnectedTo);

	const void SetTypeSpace(eSpaceType const & SpaceType);
	const void SetMineralType(eTileType const & MatType);
	const eTileType GetMaterialType() const {return m_eMineral;}
	const bool IsSpecial() const {if(m_eTypeSpace != NORMAL)return true;else return false;}

	const void MakeIntoSpecial(Space* SpecialConnection,eSpaceType const & SpaceType);

	//NextSpace/PrevSpace used to check info on the next space, not to move or modify values
	const void SetNextSpace(Space* const& Next){m_clpNextConnection = Next;}
	const Space* NextSpace() const {return m_clpNextConnection;}
	const void SetPrevSpace(Space* const& Prev){m_clpPrevConnection = Prev;}
	const Space* PrevSpace() const {return m_clpPrevConnection;}

	//Used to move and modify values
	Space* MoveForward();
	Space* MoveBackward();
	Space* LandOn();
	Space* Jump();

	const void Update() const;
	const void SetLastSpace();
};